package es.battleship.model;

import javax.jdo.annotations.IdGeneratorStrategy;
import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;
import javax.jdo.annotations.PrimaryKey;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

import com.google.appengine.api.datastore.Key;

/**
 * A shot in the board is represented with two coordinates (x,y)
 * 
 * @author mhuertas
 *
 */



@XmlRootElement
@PersistenceCapable
public class Shot {
	@PrimaryKey
    @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
    private Key id;


	/**
	 * Coordinate x of the shot
	 */
	@Persistent
	private int x;
	/**
	 * Coordinate y of the shot
	 */
	@Persistent
	private int y;

	public Shot() {
		super();
	}
	
	public Shot(int x, int y) {
		super();
		this.x = x;
		this.y = y;
	}
	
	
	
	
	public Key getId() {
		return id;
	}

	public void setId(Key id) {
		this.id = id;
	}

	public int getX() {
		return x;
	}
	public void setX(int x) {
		this.x = x;
	}
	public int getY() {
		return y;
	}
	public void setY(int y) {
		this.y = y;
	}

	public String toString() {
		return "Shot { Id: "
					+ id 
					+ " x: " 
					+ x 
					+ " y: " 
					+ y
					+ " } "; 
	}

}
